//
//  String+Extension.swift
//  SinaWeibo_18
//
//  Created by mac on 15/10/17.
//  Copyright © 2015年 cz. All rights reserved.
//

import Foundation
import UIKit


extension String{
    
    func size(font: UIFont,constraintedToSize: CGSize = CGSizeZero) -> CGSize{
        
        let str = self as NSString
        let attr = [
            NSFontAttributeName: font
        ]
        
//        return str.sizeWithAttributes(attr)
        return str.boundingRectWithSize(constraintedToSize, options: NSStringDrawingOptions.UsesLineFragmentOrigin, attributes: attr, context: nil).size
    }
}